


<style>
    .bs-docs-example {
        cursor: move;
    }
</style>
<style>
    .messageLog{
        height: 360px;
        margin-bottom: 20px;
/*        background-color: #FDFDFC;*/
        margin-left: 10px;
        background: none repeat scroll 0 0 #FDFDFD;
        border: 1px solid #DDD;
    }
    .well{
        margin-left: 10px;
        padding: 7px 15px;
    }
    .name{
        font-size: 10px;
        font-weight:bold;
    }
    form{
        margin:0px;
    }
    ul{
        margin: 0px;
    }
    .bs-docs-example {
        border-radius: 1px;
    }
</style>

<div class="span12">

    <div class="span8">

<?php if (isset($project)) { ?>



    <?php if (isset($SprintStories)){
        echo '<h3>'.'Sprint '.($this->params['pass'][2] + 1).': '.$this->Html->link(h($project['Project']['name']),'view/'.$project['Project']['id']).'</h3>';

    }
    else{?>

                    <?php
                    echo '<h3>Proyecto :'.$this->Html->link(h($project['Project']['name']),'view/'.$project['Project']['id']).'</h3>';

    } ?>
  

    <?php if (isset($SprintStories)){
        $project['Story']=$SprintStories;
    }
    ?>

        <div id="success" ></div>
        <div id="error"></div>
        <span id="sending" class="label label-inverse"  style="display: none; ">Sending...</span>
<!--        <div id="sending" style="display: none; background-color: lightgreen">Sending..</div>-->
        <div class="well" align="center" style="  padding: 20px;">
               
                    <?php


                echo $this->Form->create('Story', array('url' => '../stories/addPlanning', 'class'=>'form-inline' ,'id'=>'storyForm'));
                ?>
                <fieldset>

                    <?php
                        $sprint=0;
                        if (isset($this->params['pass'][2]))  $sprint=$this->params['pass'][2];
                        echo $this->Form->input('sprint',array('type' => 'hidden','value'=>$sprint,'id'=>'sprint'));
                        echo $this->Form->input('project_id',array('type' => 'hidden','value'=>$idProject,'id'=>'project_id'));
                        echo $this->Form->input('creator_id',array('type' => 'hidden','value'=>AuthComponent::user('id'),'id'=>'creator_id'));

                        $optionsLabel = array('class' => 'control-label','text'=>'Resumen');
                        $options = array('div' => false,'label'=>false,'class'=>'controls','id'=>'summary');
                        echo $this->Form->input('summary',$options);

//                        $optionsLabel = array('class' => 'control-label','text'=>'Detalle');
//                        $options = array('div' => 'control-group','label'=>$optionsLabel,'class'=>'controls','rows' => '3','id'=>'detail');
//                        echo $this->Form->input('detail',$options);

                        ?>


                <?php
               ?>
            <input class="btn btn-primary" id="submitStory" type="submit" value="Nueva Historia">
                        <?php


                        echo $this->Form->end();//$optionsBtn
                        ?>


            </fieldset>
    </div>

                    
    <br/>

        <?php

        //var_dump($stories[0]['Story']);
        ?>
        
        <div class="row-fluid">
                <div <?php if($accordion) {?> class="accordion" id="accordion2"<?php } else {?> class="span12" <?php } ?> >
                    <?php if($accordion) {?>
                                
                    <?php } ?>


        <?php for ($j=0;$j<4;$j++){ ?>
         <div <?php if($accordion) {?> class="accordion-group" id="accordion2"<?php } else {?> class="span3" <?php } ?>>
             <div id="estado<?php echo $j;?>"
                   <?php if($accordion) {?> class="accordion-heading"<?php } else {?> class="well" <?php } ?> id="box_estado<?php echo $j;?>" style="
                    background: <?php
                    if ($j==0)echo "#1e221e";
                    if ($j==1)echo "#F89406";
                    if ($j==2)echo "#3A87AD";
                    if ($j==3)echo "#468847";
                 ?>;
                    color: white;
                    border-radius: 5px;
                    padding: 10px;
                ">
                 <?php
                 if($accordion) {?>
                    <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse_<?php echo $j; ?> " style="color: white;">
                     <?php } ?>

                 <?php
                    if ($j==0)echo "ToDo";
                    if ($j==1)echo "Doing";
                    if ($j==2)echo "Review";
                    if ($j==3)echo "Done";
                 ?>
                 <?php
                 if($accordion) {?>
                    </a>
                 <?php } ?>

             </div>

         <?php
            if($accordion) {?>
                    <div id="collapse_<?php echo $j; ?>" class="accordion-body collapse">
                                  <div class="accordion-inner">
                     <?php }
            for ($i=0; $i<count($stories);$i++){


                if ($stories[$i]['Story']['state']==$j){?>
                    <div id="<?php echo $stories[$i]['Story']['id'] ?>" class="bs-docs-example">
<!--                        <ul class="nav nav-pills pull-right">
                            <?php if ($permiso){?>
                            <li>
                                <a data-toggle="modal" href="#editStory<?php echo $stories[$i]['Story']['id'] ?>" role="button"  ><i class="icon-edit"></i></a>
                                <?php
                                    echo $this->element('stories/editStory',array("story" => $stories[$i]['Story'],"pSprints" => $project['Project']['sprints'],"from"=>3,"members"=>$members));

                                ?>
                            </li>
                            <?php } ?>
                            <li>
                                <a data-toggle="modal" href="#pokerStory<?php echo $stories[$i]['Story']['id'] ?>" role="button"  ><i class="icon-time"></i></a>
                                <?php
                                    echo $this->element('stories/pokerStory',array("story" => $stories[$i],"pSprints" => $project['Project']['sprints'],"from"=>3,"members"=>$members));

                                ?>
                            </li>
                            <?php if ($permiso){?>
                            <li>
                            <?php

                            echo $this->Form->postLink(
                                            '<i class="icon-trash"></i>', //le image
                                            '/stories/delete/'.$stories[$i]['Story']['id'].'/1', //,le url
                                            array('escape' => false,'confirm' => 'Are you sure?','class' => 'nav-pills'));

                                        ?>
                            </li>
                            <?php } ?>
                        </ul>-->
                        <p>
                            <?php echo $this->Html->link($i+1,array('controller'=>'stories','action'=>'view', $stories[$i]['Story']['id'])); ?>

                            <?php echo $stories[$i]['Story']['summary']?>
                            <br/>
                            <?php echo $stories[$i]['Story']['detail']?>
                            <br/>
                            <?php echo $this->Html->link('Sprint: '.($stories[$i]['Story']['sprint']+1),'backlogGrid/'.$project['Project']['id'].'/'.$stories[$i]['Story']['sprint']); ?>
                        </p>

                        </div>
                    <?php }

                    }?>
                    <ul></ul>
                    <ul id="app_estado<?php echo $j;?>">
                    </ul>
                     <?php if($accordion) {?>
                            </div>
                                </div>
                     <?php } ?>
                    </div>
             <?php } ?>
        </div></div>

<?php } else {?>
    <br/>
    <div class="alert alert-info">
        Error de acceso.
    </div>
<?php }?>


    </div>
    <div class="span4">

            <div class="widget-box widget-chat" style=" margin-top: 0px;">
                    <div class="widget-title">
                            <span class="icon">
                                    <i class="icon-comment"></i>
                            </span>
                            <h5>Chat</h5>
                            <div id="user" style="display: none;">
                                <?php echo AuthComponent::user('username');?>
                            </div>
                            <div id="gravatar" style="display: none;"><?php echo AuthComponent::user('gravatar');?></div>
                            <div id="idProject" style="display: none;"><?php echo $idProject;?></div>
                            <div id="sprintVal" style="display: none;"><?php echo $sprint;?></div>
                    </div>
                    <div class="widget-content nopadding">
<!--                            <div class="chat-content panel-left">                   -->
                                <div class="chat-messages" id="chat-messages">
                                    <div id="chat-messages-inner">
                                        <ul>

                                        </ul>

<!--                                        <p id="msg-2" class="user-you" style="display: block;">
                                            <img src="img/demo/av1.jpg" alt="">
                                            <span class="msg-block">
                                                <strong>You</strong>
                                                <span class="time">- 21:24</span>
                                                <span class="msg">hola</span>

                                            </span>
                                        </p>-->

                                    </div>
<!--                                    <div  class="messageLog">
                                        <ul>
                                            This will be populated dynamically.
                                        </ul>
                                    </div>
                                                   -->
                                </div>
                                <form class="chat-message well" id="chatForm">
                                            <button class="btn btn-success">Send</button>
                                            <span class="input-box">
                                                    <input type="text" name="message" id="chatMsg">
                                            </span>
                                </form>
<!--                            </div>-->
<!--                            <div class="chat-users panel-right">
                                    <div class="panel-title"><h5>Online Users</h5></div>
                                    <div class="panel-content nopadding">
                                            <ul class="contact-list">
                                                    <li id="user-michelle" class="online new"><a href="#"><img alt="" src="img/demo/av1.jpg"> <span>Michelle</span></a><span class="msg-count badge badge-info">3</span></li>

                                                    <li id="user-cartoon-man" class="online"><a href="#"><img alt="" src="img/demo/av3.jpg"> <span>Cartoon Man</span></a></li>
                                                    <li id="user-rick-newton" class="online"><a href="#"><img alt="" src="img/demo/av1.jpg"> <span>Rick Newton</span></a></li>
                                                    <li id="user-zack-renson" class="online new"><a href="#"><img alt="" src="img/demo/av2.jpg"> <span>Zack Renson</span></a><span class="msg-count badge badge-info">1</span></li>
                                                    <li id="user-vladimir-ivanov"><a href="#"><img alt="" src="img/demo/av3.jpg"> <span>Wladimir Ivanov</span></a></li>
                                                    <li id="user-master-moda"><a href="#"><img alt="" src="img/demo/av1.jpg"> <span>Master Moda</span></a></li>
                                            </ul>
                                    </div>
                            </div>-->
                    </div>
            </div>
    </div>
</div>
<div
id="pubnub"
pub-key="pub-7b6592f6-4ddb-4af6-b1b3-0e74cefe818d"
sub-key="sub-f4baaac5-87e0-11e0-b5b4-1fcb5dd0ecb4"
origin="pubsub.pubnub.com"
ssl="off">
</div>
 